//
//  UIView+Extension.swift
//  Weibo
//
//  Created by 张远文 on 16/4/30.
//  Copyright © 2016年 张远文. All rights reserved.
//

import UIKit

extension UIView {
    
    func NavController() -> UINavigationController? {
        
        //获取当前对象的写一个响应者
        var next = self.nextResponder()
        repeat {
            
            if next is UINavigationController {
                return next as? UINavigationController
            }
            next = next?.nextResponder()
            
        } while (next != nil)
        
        return nil
    }
}